import request from '@/utils/request';
import { rsaEncrypt } from '@/utils/commonUtil3';

// 门店管理
// 添加门店
export function addShop(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/store/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}
// 获取门店列表
export function getShopList(data) {
	return request({
		url: '/store/select',
		method: 'get',
		params: data
	});
}

// 获取门店角色列表
export function getShopRoleList(data) {
	return request({
		url: '/sysRole/selectSysRole',
		method: 'get',
		params: data
	});
}

// 获取门店详情
export function getShopDetail(data) {
	return request({
		url: '/store/selectDetails',
		method: 'get',
		params: data
	});
}

// 修改门店详情
export function updateShopDetail(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/store/update',
		method: 'put',
		data: {
			data: data1
		}
	});
}
export function updateShopUser(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/store/updateUser',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 获取收银机列表
export function getPosList(data) {
	return request({
		url: '/cashier/select',
		method: 'get',
		params: data
	});
}

// 获取收银机详情
export function getPosDetail(data) {
	return request({
		url: '/cashier/select/details',
		method: 'get',
		params: data
	});
}

// 获取门店列表
export function getShopEasy(data) {
	return request({
		url: '/store/selectList',
		method: 'get',
		params: data
	});
}

// 新增收银机
export function addPos(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/cashier/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 修改门店详情
export function updatePosDetail(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/cashier/update',
		method: 'put',
		data: {
			data: data1
		}
	});
}

// 门店模糊查询
export function getSearchShopList(data) {
	return request({
		url: '/store/selectLike',
		method: 'get',
		params: data
	});
}

// 获取会员列表
export function getMemberList(data) {
	return request({
		url: '/member/select',
		method: 'get',
		params: data
	});
}

// 删除会员
export function delMember(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/member/delete',
		method: 'delete',
		data: {
			data: data1
		}
	});
}

// 获取会员详细信息
export function getMembeDetail(data) {
	return request({
		url: '/member/selectDetails',
		method: 'get',
		params: data
	});
}

// 分页查看期初库存记录列表
export function getSelectInitialLogs(data) {
	return request({
		url: '/initialInventory/selectInitialLogs',
		method: 'get',
		params: data
	});
}

// 分页条件查询门店商品库存记录
export function getSelectStoreGoodsInventoryLogs(data) {
	return request({
		url: '/storeStock/select',
		method: 'get',
		params: data
	});
}

// erp分页获取门店盘点信息
export function getSelectStoreCheckInfo(data) {
	return request({
		url: '/pda/selectStocktakingByErp',
		method: 'get',
		params: data
	});
}

// erp分页获取门店盘点信息详情
export function getSelectStoreCheckInfoDetails(data) {
	return request({
		url: '/pda/getTasksSummaryByErp',
		method: 'get',
		params: data
	});
}

// 分页查看门店零售价修改记录列表
export function getSelectRetailPriceLogs(data) {
	return request({
		url: '/storePriceLogs/select',
		method: 'get',
		params: data
	});
}

// 调拨名称、助记符、条码模糊查询商品
export function searchGoodsList(data) {
	return request({
		url: '/allocation/findLike',
		method: 'get',
		params: data
	});
}

// 根据商品查询批次
export function getBatchList(data) {
	return request({ url: '/allocation/getBatch', method: 'get', params: data });
}

// 创建调拨单
export function createAllocation(data) {
	const data1 = rsaEncrypt(data);
	return request({
		url: '/allocation/insert',
		method: 'post',
		data: {
			data: data1
		}
	});
}

// 获取门店调拨列表
export function getAllocationList(data) {
	return request({ url: '/allocation/select', method: 'get', params: data });
}

// 获取门店调拨详情
export function getAllocationDetail(data) {
	return request({ url: '/allocation/details', method: 'get', params: data });
}

// erp导出门店盘点信息详情
export function exportSelectStoreCheckInfoDetails(data) {
	return request({
		url: '/pda/export',
		method: 'post',
		data: data,
		responseType: 'blob'
	});
}

// 导出门店商品信息
export function exportStoreGoods(data) {
	return request({
		url: '/storeStock/export',
		method: 'post',
		data: data,
		responseType: 'blob'
	});
}

// 获取商品兑换记录列表
export function getExchangeList(data) {
	return request({ url: '/exchange/getList', method: 'get', params: data });
}

// 导出商品兑换记录
export function exportGoodsExchange(data) {
	// const data1 = rsaEncrypt(data);
	return request({
		url: '/exchange/export',
		responseType: 'blob',
		method: 'POST',
		data: data
	});
}

// 导出商品调拨信息
export function exportAllocationList(data) {
	return request({
		url: '/allocation/export/details',
		method: 'post',
		data: data,
		responseType: 'blob'
	});
}
